using System.Data;
using VanTaiProperty;
namespace VanTaiData
{
    public class clsTMEthnicController
    {
        private clsConnect cls = new clsConnect();

        #region Getdata
        public DataTable BindGirdTMEthnic(string keywords)
        {
            return cls.Search("sp_TMEthnic", "@KeyWords", keywords);
        }
        public DataTable BindGirdTMEthnicDetail(int id)
        {
            return cls.LayDuLieuParameter("sp_TMEthnic_Detail", "@Ethnic_ID", id);
        }
        #endregion

        #region Insert
        public bool InsertTMEthnic(clsTMEthnicProperty data)
        {
            cls.CreateNewSqlCommand();
            cls.AddParameter("@Ethnic_Alias", data.Ethnic_Alias);
            cls.AddParameter("@Ethnic_Name", data.Ethnic_Name);
            cls.AddParameter("@Ethnic_Note", data.Ethnic_Note);
            cls.AddParameter("@Ethnic_MaCha", data.Ethnic_MaCha);
            cls.AddParameter("@Ethnic_NameE", data.Ethnic_NameE);
            cls.AddParameter("@Ethnic_NameC", data.Ethnic_NameC);
            cls.ExecuteNonQuery("sp_TMEthnic_Insert");
            return true;
        }
        #endregion

        #region Update
        public bool UpdateTMEthnic(clsTMEthnicProperty data)
        {
            cls.CreateNewSqlCommand();
            cls.AddParameter("@Ethnic_ID", data.Ethnic_ID);
            cls.AddParameter("@Ethnic_Alias", data.Ethnic_Alias);
            cls.AddParameter("@Ethnic_Name", data.Ethnic_Name);
            cls.AddParameter("@Ethnic_Note", data.Ethnic_Note);
            cls.AddParameter("@Ethnic_MaCha", data.Ethnic_MaCha);
            cls.AddParameter("@Ethnic_NameE", data.Ethnic_NameE);
            cls.AddParameter("@Ethnic_NameC", data.Ethnic_NameC);
            cls.ExecuteNonQuery("sp_TMEthnic_Update");
            return true;
        }
        #endregion

        #region Delete
        public bool DeleteTMEthnic(int id)
        {
            cls.Delete("sp_TMEthnic_Delete", "@Ethnic_ID", id);
            return true;
        }
        #endregion
    }
}